import { createApp } from 'vue'
// import { registerApp } from './global' 用了全局注册不需引入
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// console.log('ElementPlusIconsVue',ElementPlusIconsVue)
import 'normalize.css'
import './assets/css/index.less'

import hyRequest from './service'
import './service/axios_demo'
import './service/axios'
import App from './App.vue'
import router from './router'
import store from './store'

const app = createApp(App)

// registerApp(app)
// 3. 将路由实例挂载到根实例
app.use(router)
app.use(ElementPlus)
// 将store挂载到根实例
app.use(store)

// 把所有小图标注册成全局组件
// for (const key in ElementPlusIconsVue) {
//   app.component(key, ElementPlusIconsVue[key])
// }
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.mount('#app')
// 文件导出了  这里打印可以获取到 ——vue-cli官网
console.log(process.env.VUE_APP_BASE_URL)
console.log(process.env.VUE_APP_BASE_NAME)
// axios
interface DataType {
  data: any
  returnCode: string
  success: boolean
}
hyRequest
  .get<DataType>({
    url: '/home/multidata',
    showLoading: false
  })
  .then((res) => {
    console.log(res)
  })
